﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbBlockVisibilityParameter : OdDbBlock1PtParameter
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbBlockVisibilityParameter(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbBlockVisibilityParameter_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbBlockVisibilityParameter obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbBlockVisibilityParameter()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbBlockVisibilityParameter(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbBlockVisibilityParameter cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbBlockVisibilityParameter_cast(OdRxObject.getCPtr(pObj));
			OdDbBlockVisibilityParameter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbBlockVisibilityParameter_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbBlockVisibilityParameter_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbBlockVisibilityParameter_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbBlockVisibilityParameter createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbBlockVisibilityParameter_createObject();
			OdDbBlockVisibilityParameter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbBlockVisibilityParameter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbBlockVisibilityParameter_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbBlockVisibilityParameter_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdDbBlockVisibilityParameter() : this(TD_DbPINVOKE.new_OdDbBlockVisibilityParameter__SWIG_1(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isInitialized()
		{
			bool result = TD_DbPINVOKE.OdDbBlockVisibilityParameter_isInitialized(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setInitiaized(bool arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setInitiaized(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public int currentVisibilityState()
		{
			int result = TD_DbPINVOKE.OdDbBlockVisibilityParameter_currentVisibilityState(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setCurrentVisibilityState(int arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setCurrentVisibilityState(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void clearListOfVisibilityStates()
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_clearListOfVisibilityStates(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string visibilityName()
		{
			string result = TD_DbPINVOKE.OdDbBlockVisibilityParameter_visibilityName(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setVisibilityName(string arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setVisibilityName(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string visibilityDescription()
		{
			string result = TD_DbPINVOKE.OdDbBlockVisibilityParameter_visibilityDescription(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setVisibilityDescription(string arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setVisibilityDescription(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void blockEntityList(OdDbObjectIdArray arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_blockEntityList(this.swigCPtr, OdDbObjectIdArray.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setBlockEntityList(OdDbObjectIdArray arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setBlockEntityList(this.swigCPtr, OdDbObjectIdArray.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public int numberOfVisibilityStates()
		{
			int result = TD_DbPINVOKE.OdDbBlockVisibilityParameter_numberOfVisibilityStates(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void visibilityState(int index, ref string name, OdDbObjectIdArray objects, OdDbObjectIdArray elements)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(name);
			IntPtr value = intPtr;
			try
			{
				TD_DbPINVOKE.OdDbBlockVisibilityParameter_visibilityState(this.swigCPtr, index, ref intPtr, OdDbObjectIdArray.getCPtr(objects), OdDbObjectIdArray.getCPtr(elements));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				if (intPtr != value)
				{
					name = Marshal.PtrToStringUni(intPtr);
				}
			}
		}

		public void setVisibilityState(int index, string name, OdDbObjectIdArray objects, OdDbObjectIdArray elements)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setVisibilityState(this.swigCPtr, index, name, OdDbObjectIdArray.getCPtr(objects), OdDbObjectIdArray.getCPtr(elements));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void getPropertyDescription(OdDbBlkParamPropertyDescriptorArray arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_getPropertyDescription(this.swigCPtr, OdDbBlkParamPropertyDescriptorArray.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void listVisibleEntities(OdDbObjectIdArray arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_listVisibleEntities(this.swigCPtr, OdDbObjectIdArray.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void setMemberOfCurrentVisibilitySet(bool arg0)
		{
			TD_DbPINVOKE.OdDbBlockVisibilityParameter_setMemberOfCurrentVisibilitySet(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
